package com.crl.module.logging.events
{
	import com.crl.module.logging.LoggerLevel;
	import flash.events.Event;
	
	public class LoggerEvent extends Event
	{
		public static var DEFAULT_LEVEL_STRING:String = "UNKNOWN" ;
		public static const LOG:String = "log";
		
		public var level:LoggerLevel ;
		public var message:* ;
		
		public function LoggerEvent( message:* , level:LoggerLevel )
		{
			super( LoggerEvent.LOG , false , false ) ;
			this.message = message ;
			this.level   = (level == null) ? LoggerLevel.ALL : level ;
		}
		
		public override function clone():Event
		{
			return new LoggerEvent( message , level );
		}
		
		public static function getLevelString( value:LoggerLevel ):String
		{
			if ( LoggerLevel.isValidLevel( value ) )
			{
				return value.toString() ;
			}
			else
			{
				return DEFAULT_LEVEL_STRING ;
			}
		}
	}
}